package com.shamar.blog.enums;

/**
 * @ClassName PayOrderStatusEnum
 * @Description 支付订单状态枚举
 * @Author husheng
 * @Date 2019-12-26 15:20
 */
public enum PayOrderStatusEnum {

    PRE_CREATE(0, "预创建"),
    PRE_CREATE_SUCCESS(1, "预创建成功"),
    FAIL(2, "交易失败"),
    SUCCESS(3, "交易成功"),
    REFUNDING(4, "退款中"),
    REFUND_FINISH(5, "退款完成"),
    UNKNOW(6, "未知"),
    CLOSED(7, "关单")
    ;

    private int code;
    private String describe;

    PayOrderStatusEnum(int code, String describe) {
        this.code = code;
        this.describe = describe;
    }

    public int getCode() {
        return code;
    }

    public String getDescribe() {
        return describe;
    }

    public static PayOrderStatusEnum getByCode(int code){
        for(PayOrderStatusEnum payOrderStatusEnum : PayOrderStatusEnum.values()){
            if(payOrderStatusEnum.code == code){
                return payOrderStatusEnum;
            }
        }
        return null;
    }
}
